//
// Created by lqk on 2022/2/21.
//

#ifndef QUADCEREBELLUM_PYBULLETIMUDRIVER_H
#define QUADCEREBELLUM_PYBULLETIMUDRIVER_H

#include "PeriodicTaskManager.h"
#include "PeriodicTask.h"
#include "SensorStructs.h"
#include "lcm/lcm-cpp.hpp"
#include "quad_bot/IMU_info_pb.hpp"

extern IMUInfo g_IMUInfo;

class PyBulletIMUDriver :public PeriodicTask {
public:
    PyBulletIMUDriver(PeriodicTaskManager* taskManager,const float& period,const std::string& name,const std::string& subChannel):PeriodicTask(taskManager,period,name),m_subChannel(subChannel){}
    virtual void Init() override;
    virtual void RunOnce() override;
    virtual void PrintStatus() override;
private:
    virtual void CleanUp() override;
    void Callback(const lcm::ReceiveBuffer* rbuf,const std::string& channel,const quad_bot::IMU_info_pb* msg);

    lcm::LCM m_lcmSub;
    int m_lcmSubHandle=0;
    const std::string m_subChannel;
};


#endif //QUADCEREBELLUM_PYBULLETIMUDRIVER_H
